﻿using System;

namespace Cpu6502.Opcodes
{
    class RTS : Opcode
    {
        public RTS()
        {
            this.CpuCycles = 6;
            this.AddressType = CPU.AddressType.Implied;
        }

        public override void Execute()
        {
            // Get return address from the stack
            int jmpAddress = CPU.Stack.Pop();
            jmpAddress += ((CPU.Stack.Pop()) << 8) + 1;
            
            CPU.PC = jmpAddress;
        }
    }
}
